#!/usr/bin/python3
# @Time    : 2024-03-20 下午 4:07
# @Author  : MingYangHe
# @Email   : 1780040868@qq.com


# 此块代码的精髓就是动态调节滑动窗口的起始位置
nums = [2, 3, 1, 2, 4, 3]
s = 7
sum = 8
subLength = 0
res = float('inf')
while sum >= s:
    i = 0
    j = 3
    subLength = (j - i + 1)
    res = res if res < subLength else subLength
    sum -= nums[i]
    i += 1


print(res)
